<?php


namespace Part26_SharingElementMode\Code3;

/**
 * 网站工厂
 */
class WebSiteFactory
{
    private $flyweights;

    public function getWebSiteCategory($key)
    {
        if (!isset($this->flyweights[$key])) {
            $this->flyweights[$key] = new ConcreteWebsite($key);
        }
        return $this->flyweights[$key];
    }

    public function getWebSiteCount()
    {
        return count($this->flyweights);
    }
}